<?php


namespace App\Model;


use Illuminate\Database\Eloquent\Model;

/**
 * App\Model\Setting
 *
 * @property int $id
 * @property string $type 设置类型
 * @property string $value 设置值
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Setting whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Setting whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Setting whereType($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Setting whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Setting whereValue($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Setting newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Setting newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Setting query()
 * @mixin \Eloquent
 */
class Setting extends model
{
    protected $table = 'setting';

    // 系统运费
    const TYPE_SHOPPING_PRICE = 'shopping_price';

    const TYPE_LOGO = 'logo';

    const TYPE_BANNER = 'banner';

    public static function getShoppingPrice()
    {
        $model = Setting::where('type', static::TYPE_SHOPPING_PRICE)->first();
        return number_format($model->value, 2);
    }

}
